package com.exposit.books.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.exposit.books.service.GenreService;

@Controller
public class GenreController {
	
	@Autowired
	private GenreService genreService;
	
	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String index(Model model) {
		
	
		/*Genre genre1 = genreService.getGenreById(2L);
		genre1.setBoughtCount(2L);
		genreService.updateGenre(genre1);*/
		String genre= "test";//genre1.getName();
		
		
		model.addAttribute("genre", genre);
		
		model.addAttribute("name", "Mike");
		
		return "index";
	}
	
	@RequestMapping(value = "/publishedOffice", method = RequestMethod.GET)
	public String publishedOffice(Model model) {
		
	
		/*Genre genre1 = genreService.getGenreById(2L);
		genre1.setBoughtCount(2L);
		genreService.updateGenre(genre1);*/
		String genre= "test";//genre1.getName();
		
		
		model.addAttribute("genre", genre);
		
		model.addAttribute("name", "Mike");
		
		return "publishedOffice";
	}
	
	@RequestMapping(value = "/admin", method = RequestMethod.GET)
	public String admin(Model model) {
		
	
		/*Genre genre1 = genreService.getGenreById(2L);
		genre1.setBoughtCount(2L);
		genreService.updateGenre(genre1);*/
		String genre= "test";//genre1.getName();
		
		
		model.addAttribute("genre", genre);
		
		model.addAttribute("name", "Mike");
		
		return "admin";
	}
	
	@RequestMapping(value = "/shop", method = RequestMethod.GET)
	public String shop(Model model) {
		
	
		/*Genre genre1 = genreService.getGenreById(2L);
		genre1.setBoughtCount(2L);
		genreService.updateGenre(genre1);*/
		String genre= "test";//genre1.getName();
		
		
		model.addAttribute("genre", genre);
		
		model.addAttribute("name", "Mike");
		
		return "shop";
	}
	
}
